package com.campus.service.impl;

import com.campus.entity.TSysUser;
import com.campus.mapper.UserMapper;
import com.campus.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService {


    @Autowired
    private UserMapper userMapper;

    @Override
    public int login(Integer id, String password) {
        return userMapper.login(id,password);
    }

    @Override
    public int creatUser(Integer id, String loginName, String password, String gender, String birthday, String phone, String email, String status) {
        TSysUser tSysUser = new TSysUser();
        tSysUser.setBirthday(birthday);
        tSysUser.setEmail(email);
        tSysUser.setGender(gender);
        tSysUser.setId(id);
        tSysUser.setLoginName(loginName);
        tSysUser.setPassword(password);
        tSysUser.setPhone(phone);
        tSysUser.setStatus(status);

        return userMapper.createUser(tSysUser);

    }

    @Override
    public List<TSysUser> query(Integer id, String loginName) {
        return userMapper.queryUser(id, loginName);
    }
}
